/**
 * @ Author: luoqi
 * @ Create Time: 2025-06-29 20:00
 * @ Modified by: luoqi
 * @ Modified time: 2025-11-07 00:58
 * @ Description:
 */

#ifndef _QTERM_H
#define _QTERM_H

#ifdef __cplusplus
extern "C" {
#endif

#include <bsp.h>
#include "qcli/qcli.h"
#include "qstr.h"

#ifndef QNULL
#define QNULL ((void *)0)
#endif

#define QSH(...)                kprintf(__VA_ARGS__)
#define ISARG(str1, str2)       (qstrcmp(str1, str2) == 0)
#define ISARGV(n, str)          (qstrcmp(argv[n], #str) == 0)
#define ISARGC(n)               (argc == n)

#define HEX_PRINT(ptr, size)     do{                  \
    for(int i = 0; i < size; i++){                    \
        kprintf(" %02X", ptr[i]);                     \
    }                                                 \
    kprintf("\r\n");                                  \
} while(0)

int cli_init(void);

int cli_exec(char c);

int cli_echo(char *args);

int cli_add(const char *name, QCliCallback callback, const char *usage);

int cli_del(const char *name);

int cli_help(QCliArgsTable *table, uint32_t sz);

#ifdef __cplusplus
}
#endif
#endif
